import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import fire from '@dfeidao/atom-web/msg/fire';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import render from '@dfeidao/atom-web/render/render';
import p001 from './p001';
import p002 from './p002';
export default async function a003(fd: IFeidaoAiBrowserComponent) {
	// todo
	const name1 = fd.data.node.querySelector<HTMLInputElement>('[data-id="name"]');
	const name = name1.value;
	if (!name ) {
		fire('zj-000005','a001');
		return;
	}
	const res = await nodejs<Array<{}>>('risk-control/zj-000005/s002', {pn:1,name });
	const dtdata = fd.data.node.querySelector<HTMLDivElement>('[data-feidao-presentation="p001"]');
	const dtNodata = fd.data.node.querySelector<HTMLDivElement>('[data-feidao-presentation="p002"]');
	if (res.length > 0 ) {
		render(fd,res,p001,'p001','inner');
		dtdata.style.display = 'block';
		dtNodata.style.display = 'none';
	}
	if (res.length <= 0) {
		render(fd,"",p002,'p002','inner');
		dtdata.style.display = 'none';
		dtNodata.style.display = 'block';
	}
	const No = fd.data.node.querySelector<HTMLDivElement>('[data-feidao-presentation="p003"]');
	No.style.display = "none";
}
